#include "party-protocol/channel.hpp"
#include "party-protocol/packet.hpp"
#include "party-protocol/receiver.hpp"
#include <asm-generic/socket.h>
#include <sys/socket.h>
#include <cstdio>
#include <iostream>

int main(){
    int a=socket(AF_INET,SOCK_DGRAM,0);
    int flag=1;
    setsockopt(a, SOL_SOCKET, SO_BROADCAST, &flag, sizeof(flag));
    std::function<bool (Packet*)> onreceive=[](Packet *p){
        return true;
    };
    Channel c=Channel(1, channel_unreliable, 10, a, onreceive);
    Receiver r=Receiver();
    r.addChannel(&c);
    char characters[128];
    while (true) {
        std::cin>>characters;
        c.send(characters, strlen(characters)+1);
    }
    return 0;
}
